package cn.qf.first.dao;

import cn.qf.first.entity.Food;
import cn.qf.first.entity.Shop;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;

import java.util.ArrayList;
import java.util.List;

/**
 * @date: 2021/6/21 11:46
 * @description:
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"classpath:spring-context.xml"
        ,"classpath:spring-mybatis.xml","classpath:spring-mvc.xml"})
@WebAppConfiguration
public class OrderMappertset {
    @Autowired
    private OrderMapper orderMapper;
    @Autowired
    private ShopMapper shopMapper;

    @Test
    public void testSelectById(){
        ArrayList<Long> foods = new ArrayList<>();
        foods.add(1L);
        foods.add(2L);
        foods.add(3L);
        List<Food> food = orderMapper.selectById(foods);
        food.forEach(item-> System.out.println(item));
    }


    @Test
    public void testSelectShop(){
        List<Shop> shops = shopMapper.selectShop();
        shops.forEach(item-> System.out.println(item));
    }


    @Test
    public void testSelectShopByName(){
        String name = "烧烤";
        List<Shop> shop = shopMapper.selectShopByName(name);
        System.out.println(shop);
    }

    @Test
    public void testdelectShopById(){
        Long id = 4l;
        int i = shopMapper.delectShopById(id);
        System.out.println(i);
    }
}
